package notes.interview.saved;

import java.util.Arrays;

// 参数传递
public class T0004_params{
	
	public static void main(String[] args) {
		
		int i = 1;
		String s = "hello";
		Integer num = 200;
		int[] arr = {1, 2, 3, 4, 5};
		Day day = new Day();
		
		change(i, s, num, arr, day);
		
		System.out.println("i=" + i);// 值传递， 是基本元素值传递
		System.out.println("s=" + s);// string是不可变的
		System.out.println("num=" + num);// 地址传递，设值后产生新的地址，原地址不变
		System.out.println("arr=" + Arrays.toString(arr));// 地址传递，修改了元素
		System.out.println("day.i=" + day.i);// // 地址传递，修改了元素
	}
	
	private static void change(int i, String s, Integer num, int[] arr, Day day) {
		i += i + 1;
		s += "world";
		num += 1;
		arr[0] = 2;
		day.i = 11;
	}
}

class Day {
	int i = 10;
}
